import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router'
import Layout from '@/Layout.vue'

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history:createWebHashHistory(),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: Layout,
      alias: '/layout',
      children: [
        {
          path: '/user_list',
          name: 'user_list',
          component: () => import('../views/user/ListView.vue')
        },
        {
          path: '/banner_add',
          name: 'banner_add',
          component: () => import('../views/banner/AddView.vue')
        },
        {
          path: '/banner_list',
          name: 'banner_list',
          component: () => import('../views/banner/ListView.vue')
        },
        {
          path: '/navi_add',
          name: 'navi_add',
          component: () => import('../views/navi/AddView.vue')
        },
        {
          path: '/navi_list',
          name: 'navi_list',
          component: () => import('../views/navi/ListView.vue')
        },
        {
          path: '/',
          name: 'category',
          component: () => import('../views/exam/Category.vue')
        },
        {
          path: '/test_paper',
          name: 'test_paper',
          component: () => import('../views/exam/TestPager.vue')
        },
        {
          path: '/topic',
          name: 'topic',
          component: () => import('../views/exam/Topic.vue')
        },
        {
          path: '/score',
          name: 'score',
          component: () => import('../views/exam/Score.vue')
        },
        {
          path: '/setting',
          name: 'setting',
          component: () => import('../views/setView.vue')
        },
      ]
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('../views/HomeView.vue')
    },
    {
      path: '/admin',
      name: '/admin',
      component: () => import('../views/AdminView.vue')
    },
    {
      path: '/login',
      name: '/login',
      component: () => import('../views/LoginView.vue')
    },
    // {
    //   path:'/:catchAll(.*)',
    //   redirect:'../views/user/ListView.vue'
    // }
   {
    path: '/:pathMatch(.*)*',
    component: () => import('../views/ErrView.vue')
   }
  ]
})

export default router
